use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};

#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
#[sea_orm(table_name = "cms_snapshot")]
pub struct Model {
    #[sea_orm(primary_key)]
    pub id: i32,
    /// 所属专题
    #[sea_orm(indexed)]
    pub article_id: i32,
    /// 状态(0 草稿, 1 已发布, 2 自动保存,3 历史保存)
    pub status: i8,
    /// 内容
    #[sea_orm(column_type = "custom(\"LONGTEXT\")")]
    pub content: String,
    pub is_publish: bool,
    pub is_draft: bool,
    pub is_markdown: bool,
    pub publish_at: chrono::NaiveDateTime,
    pub created_at: chrono::NaiveDateTime,
    pub updated_at: chrono::NaiveDateTime,
}

#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {}

impl ActiveModelBehavior for ActiveModel {}
